﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ListDonThu.ascx.cs" Inherits="CMS.Web.CompDenu.ListDonThu" %>
<table width="96%" align="center" class="Table_Border" style="border-collapse: collapse" cellSpacing="0" cellPadding="0" border="0">
    <tr>
        <td valign="middle" align="center" height="50px">
            <font class="Title">DANH SÁCH ĐƠN THƯ KHIẾU NẠI TỐ CÁO</font></td>
    </tr>
    <tr>
        <td valign="top">
            <table class="Grid_Border" cellspacing="0" cellpadding="3" width="100%" border="0">
                <tr>
                    <td class="Col_Left" style="width:14%;padding-left: 10px">Địa bàn:</td>
		            <td class="Col_Right" style="width:28%;">
		                <asp:textbox id="drpDiaBan" runat="server" CssClass="TextBox" Width="90%"></asp:textbox>
			            <img src="Images/scroll2.png" style="display:; cursor: pointer; cursor: hand;" onclick="openSelectMultiDiaBanWindow('<% =drpDiaBan.ClientID%>','<%=hidDiaBan.ClientID %>');" />
			            <asp:HiddenField ID="hidDiaBan" runat="server" Value="0" />		            
                    </td>
                    <td class="Col_Left" style="width:20%;text-align:right;">Họ tên người đề đơn:&nbsp;</td>
		            <td class="Col_Right">
		                <asp:TextBox ID="txtNguoiDeDon" runat="server" MaxLength="100" Width="96%" CssClass="TextBox"></asp:TextBox>
                    </td>  
                </tr>      
                <tr>
                    <td class="Col_Left" style="padding-left: 10px">Nội dung đơn:</td>
		            <td class="Col_Right" colspan="3">
		                <asp:TextBox ID="txtNoiDungDon" runat="server" MaxLength="100" Width="98%" CssClass="TextBox"></asp:TextBox>
                    </td>  
                </tr>  
                <tr>
                    <td class="Col_Left" style="padding-left: 10px">Ngày nhận đơn:&nbsp;</TD>
		            <td class="Col_Right" colspan="2">
		            <asp:textbox id="txtTuNgay" runat="server" CssClass="TextBox" Width="20%" MaxLength="10" Enabled="true"></asp:textbox>
		            &nbsp;đến ngày&nbsp;<asp:textbox id="txtDenNgay" runat="server" CssClass="TextBox" Width="20%" MaxLength="10" Enabled="true"></asp:textbox>
			        </td>
		            <td class="Col_Right" style="text-align:right;padding-right:18px;">
		                <asp:Button id="lbnFilter" Text="Lọc" Width="90px" CssClass="Button" runat="server" OnClick="lbnFilter_Click" />
		                <asp:Button id="lbnDefault" Text="Mặc định" Width="90px" CssClass="Button" runat="server" OnClick="lbnDefault_Click" />
                    </td>  
                </tr>                
            </table>
        </td>
    </tr>
    <tr>
        <td style="height:2px;"></td>
    </tr>
    <tr>
        <td style="height:40px;line-height:20px;text-align:right;padding-right:10px;color:#0B73F4">
        Có <font style="color:#ee6e35"><%=iDaXuLy%></font> đơn đã xử lý;&nbsp;Có <font style="color:#ee6e35"><%=iChuaXuLy%></font> đơn chưa xử lý
        <br /> Có <font style="color:#ee6e35"><%=iQuaHan%></font> đơn quá hạn;&nbsp;Có <font style="color:#ee6e35"><%=iQuaHanDaXuLy%></font> đơn quá hạn đã xử lý.
        </td>
    </tr>
    <tr>
        <td style="height:2px;"></td>
    </tr>
    <tr>
        <td align=center valign=top>
            <asp:GridView ID="gridObj" runat="server" AllowPaging="True" AutoGenerateColumns="False" DataKeyNames="ID"
                Width="100%" CellPadding="4" ForeColor="#333333" GridLines="None" 
                PageSize="15" OnPageIndexChanging="gridObj_PageIndexChanging" BackColor="Transparent" BorderColor="#58b5fc"
                EmptyDataText="Không có đơn thư nào!" EmptyDataRowStyle-CssClass="Grid_Error" OnRowCreated="gridObj_RowCreated" CssClass="Grid_Border">
                <Columns>
                    <asp:TemplateField HeaderStyle-Width="10px">
                            <HeaderTemplate>
                              <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                            </HeaderTemplate>
                            <ItemTemplate>
                                <asp:CheckBox ID="chkSelect" runat="server" Enabled="true" />
                            </ItemTemplate>
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Sửa" HeaderStyle-Width="15px">                        
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <a class="Link-button" href="<%=BaseUrl%>&action=EDIT&objID=<%# Eval("ID")%>">
                                <img src="Images/Icon_Compose.gif" border="0" />
                            </a>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Người viết đơn" HeaderStyle-Width="80px">
                        <HeaderStyle HorizontalAlign="Left"  />
                        <ItemStyle HorizontalAlign="Left" />
                        <ItemTemplate>
                            <%# (Eval("NguoiGuiLookup.HoTen") == null) ? "" : Eval("NguoiGuiLookup.HoTen")%>                            
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Địa chỉ" HeaderStyle-Width="100px">
                        <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" />
                        <ItemTemplate>
                            <%# (Eval("NguoiGuiLookup.DiaChi") == null) ? "" : Eval("NguoiGuiLookup.DiaChi")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Ngày gửi" HeaderStyle-Width="120px">
                        <HeaderStyle HorizontalAlign="left" />
                        <ItemTemplate>
                            <%# (Eval("NgayGui") == null) ? "" : Eval("NgayGui", "{0: dd/MM/yyyy}")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Nội dung đơn">
                        <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" />
                        <ItemTemplate>
                            <%# Eval("NoiDung")%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Loại đơn" HeaderStyle-Width="100px">
                        <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" />
                        <ItemTemplate>
                            <%# getTenLoaiDon(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "MaLoaiDon")))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Lĩnh vực">
                        <HeaderStyle HorizontalAlign="Left" />
                        <ItemStyle HorizontalAlign="Left" />
                        <ItemTemplate>
                            <%# getTenLinhVuc(Convert.ToInt32(DataBinder.Eval(Container.DataItem, "MaLinhVuc")))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="TT xử lý" HeaderStyle-Width="80px">
                        <HeaderStyle HorizontalAlign="Center" />
                        <ItemStyle HorizontalAlign="Center" />
                        <ItemTemplate>
                            <%# GetNameStartProcess(DataBinder.Eval(Container.DataItem, "ID"))%>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" CssClass="Paging_Link" />
                <RowStyle CssClass="Row_Document_Round" />
                <PagerStyle BackColor="Transparent" CssClass="Paging_NotLink" HorizontalAlign="Right" />
                <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="False" ForeColor="#333333" />
                <HeaderStyle CssClass="Row_Document_Title" />
                <EditRowStyle BackColor="Transparent" />
                <AlternatingRowStyle CssClass="Row_Document_Odd" />
            </asp:GridView>
        </td>
    </tr>
    <tr>
        <td>
			<table  id="tblButton" class="Table_Border" cellSpacing="0" cellPadding="0" width="100%">
				<tr height="25">
					<td width="100%" align=left>
                        <asp:Button id="lbnThem" Text="Thêm mới" Width="90px" CssClass="Button" runat="server" OnClick="lbnThem_Click" />
                        <%--<%if (this.IsRole)
                          { %>--%>
                        <asp:Button id="lbnXoa" Text="Xóa" Width="90px" CssClass="Button" runat="server" OnClick="lbnXoa_Click" />
                        <%--<%} %>--%>
                    </td>
				</tr>
			</table>
        </td>
    </tr>
</table>

<script language="javascript">
    function SelectAllCheckboxes(spanChk){
        var oItem = spanChk.children;
        var theBox= (spanChk.type=="checkbox") ? 
        spanChk : spanChk.children.item[0];
        xState=theBox.checked;
        elm=theBox.form.elements;
        for(i=0;i<elm.length;i++){
            if(elm[i].type=="checkbox" && elm[i].id!=theBox.id) {
                if(elm[i].checked!=xState)
                elm[i].click();
            }
        }
    }

    function doSetStatus(type){
        var count = 0;
        var allc = document.getElementsByTagName("input");   
        for (i=0; i < allc.length; i++){
            if (allc.item(i).type=='checkbox' && allc.item(i).id !="chkAll"){ 
                if (allc.item(i).checked)
                    count++;
            }
        }
        if (count==0){
            if (type==1){
                alert("Xin đánh dấu chọn trước khi cập nhật!");
            }else{
                alert("Xin đánh dấu chọn trước khi xóa!");
            }
            return false;
        }
        if(confirm("Bạn có thật sự muốn xóa?")){
            return true;
        }else{
            return false;
        }
    }
    jQuery(function($){
        $("#<%=txtTuNgay.ClientID %>").datepicker();
        $("#<%=txtDenNgay.ClientID %>").datepicker();
    }); 
</script>